#include <bits/stdc++.h>
using namespace std;

class Solution{
public:
    char kthCharacter(int k){
        string s="a";
        while(s.size()<k){
            string tmp;
            for(char c:s)tmp.push_back((c-'a'+1)%26+'a');
            s+=tmp;
        }
        return s[k-1];
    }
};

#define ll long long
class Solution2_3{
public:
    int countOf(string word, int K){
        int n=word.size();
        auto check=[&](char c){
            return c=='a'||c=='e'||c=='i'||c=='o'||c=='u';
        };
        auto calc=[&](int K)->int{
            ll ret=0; int cnt[26]={0}, good=0,x=0;
            for(int i=0,j=0;i<n;i++){
                while(j<n&&(good<5||x<K)){
                    if(check(word[j])){
                        int t=cnt[word[j]-'a']++;
                        if(t==0) good++;
                    } else x++;
                    j++;
                }
                if(good==5&&x>=K) ret+=n-j+1;
                if(check(word[i])){
                    int t=--cnt[word[i]-'a'];
                    if(t==0) good--;
                } else x--;
            }
            return ret;
        };
        return calc(K)-calc(K+1);
    }
};

//#define ll long long
//class Solution3{
//public:
//    ll countOfSubstrings(string word, int k){
//
//    }
//};

class Solution4{
public:
    char kthChar(ll K, vector<int>& ope){
        if(K==1) return 'a';
        int lim; ll len=1;
        for(lim=0;lim<ope.size();lim++){
            len*=2; if(len>=K) break;
        }
        int bias=0;
        for(int i=lim;i>=0;i--){
            if(K>len/2){
                bias+=ope[i];
                K-=len/2;
            }
            len/=2;
        }
        return bias%26+'a';
    }
};

int main(){
    Solution s; cout<<s.kthCharacter(5)<<endl;
    Solution2_3 s2; cout<<s2.countOf("aeiou",0)<<endl;
    vector<int> ope={0,0,0};
    Solution4 s4; cout<<s4.kthChar(5, ope)<<endl;
    return 0;
}